define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params) {

	$scope.form = {};

	$scope.save = function() {
		if (!$scope.formCheck()){
			return;
		}
		httpService.post(app.urls.semester_delete, $scope.form, function (data) {})
		httpService.post(app.urls.semester_insert, $scope.form, function (data) {
			if (data.code == "0000") {
				eventBusService.publish("content.page.reload", data);
				eventBusService.publish("modal.page.close", {});
			} else {
				eventBusService.publish("modal.alert", {"content": data.msg});
			}
		});
	}

	//查询学年
	$scope.getAllSchoolYear = function(){
		httpService.post(app.urls.getAcadYearTerm,{'prop_key': 'STU_YEAR'},function(data){
			if("0000" === data.code){
				$scope.schoolYearList = data.data;
			}else{
				alert(data.msg);
			}
		});
	}

	//查询学期
	$scope.getAllSchoolTerm = function(){
		httpService.post(app.urls.getAcadYearTerm,{'prop_key': 'STU_TERM'},function(data){
			if("0000" === data.code){
				$scope.schoolTermList = data.data;
			}else{
				alert(data.msg);
			}
			$scope.$applyAsync();
		});
	}

	let init = function () {
		$scope.getAllSchoolYear();
		$scope.getAllSchoolTerm();
	}

	init();

}}});